#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include "clasemasini.h"
#include "clasaclient.h"

Car* Creaza_Masina(CarFactory *fabrica)
{ int opt;
printf("Creati masina\n");
     
		   printf("Alegeti masina:\n");
		    printf("1. Sedan\n");
			printf("2. Coupe\n");
			printf("3. Mini\n");
            
			scanf("%d", &opt);
  system("CLS");
			if(opt==1) 
			{ 
				Car* CarType = fabrica->GetCar("Sedan");   
				//CarType->PrintCar();	
				system("CLS");
				return CarType;
	        }
			if(opt==2)
			{   Car* CarType = fabrica->GetCar("Coupe");
			    //CarType->PrintCar();
			    system("CLS");
			    return CarType;
		    }
			if(opt==3) 
			{   Car* CarType = fabrica->GetCar("Mini");
				//CarType->PrintCar();	
			    system("CLS");
			    return CarType;
		    }
  system("CLS");

  Car* CarType = fabrica->GetCar("Mini"); //de forma, aici nu ajunge
  return CarType;

}

 void main()
 {
   
   CarFactory *fabrica = new CarFactory();
  
   Car *car1 = Creaza_Masina(fabrica);
   Car *car2 = Creaza_Masina(fabrica);
   Car *car3 = Creaza_Masina(fabrica);
	
  Client* client1 = new Client();
	 
  client1->Add_masina(car1);
  client1->Add_masina(car2);
  

  Client* client2 = new Client();

  client2->Add_masina(car3);
 
  printf("Masinile clientului %s %s:\n", client1->GetNume(), client1->GetPrenume());
  client1->Print_Cars();

  printf("Masinile clientului %s %s:\n", client2->GetNume(), client2->GetPrenume());
  client2->Print_Cars();

 
  client1->Delete_masina(car2);
   printf("Dupa stergere, masinile clientului %s %s:\n", client1->GetNume(), client1->GetPrenume());
  client1->Print_Cars();

 }